package com.web.main.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;

/**
 * @create 2020-12-01 16:49
 */
//@Configuration
public class RedissonConfiguration {
    @Bean
    public RedissonClient redissonConfig() {
        Config config = new Config();
        //设置哨兵地址
        config.useSentinelServers()
                .addSentinelAddress("redis://192.168.197.132:26379")
                .addSentinelAddress("redis://192.168.197.132:26380")
                .addSentinelAddress("redis://192.168.197.132:26381");
        //设置哨兵名字
        config.useSentinelServers().setMasterName("mymaster");
        //设置哨兵密码
        config.useSentinelServers().setPassword("123");
        return Redisson.create(config);
    }
}
